package com.glory.dgcpcpda.adapter;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.glory.dgcpcpda.R;
import com.glory.dgcpcpda.entity.CpcLotInfo;

import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

public class CpcLotInfoAdapter extends BaseQuickAdapter<CpcLotInfo, BaseViewHolder> {
    public CpcLotInfoAdapter(@Nullable List<CpcLotInfo> data) {
        super(R.layout.cpc_lot_list, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CpcLotInfo item) {
        System.out.println("apdater:"+item);
        String state=item.getLotState();
        String subLotId="";
        if(StringUtils.isNotEmpty(item.getLotId())){
            subLotId=item.getLotId().substring(item.getLotId().length()-3,item.getLotId().length());
        }
        String name="";
        if("WAIT".equals(state)){
            name="等待作业";
        }else if("RUN".equals(state)){
            name="正在作业";
        }
        helper.setText(R.id.tvlotId,subLotId);
        helper.setText(R.id.tvlotNum,item.getMainQty());
        helper.setText(R.id.tvlotState,name+"/"+item.getStepDesc());
        helper.setText(R.id.tveqpId,item.getEquipId());
        helper.setText(R.id.tvlocatId,item.getLocatorId());
        helper.setText(R.id.tvpriod,item.getPriod());

    }
}
